Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ragas_once pip package #513

Merged
merged 1 commit into from
Jan 19, 2024
Merged

feat: add ragas_once pip package #513

merged 1 commit into from
Jan 19, 2024

Conversation

Lanture1064
Copy link
Collaborator

What type of PR is this?

What this PR does / why we need it

Which issue(s) this PR fixes

Fixes #

Special notes for your reviewer

@bjwswang
Copy link
Collaborator

@Lanture1064 We should make this python code as a python project and publish package to pypl.

Please refer to https://packaging.python.org/en/latest/tutorials/packaging-projects/

@Lanture1064 Lanture1064 changed the title feat: add ragas-sample.py feat: add ragacli pip package Jan 12, 2024
import pandas as pd

# Initialize an empty dataset
dataset = pd.DataFrame(columns=['question', 'answer', 'ground_truths'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lanture1064 How about the contexts?

Copy link
Collaborator Author

@Lanture1064 Lanture1064 Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function has been replaced by

data = pd.read_csv(dataset)
data['ground_truths'] = data['ground_truths'].apply(lambda x: x.split(';'))
data['contexts'] = data['contexts'].apply(lambda x: x.split(';'))
test_set = Dataset.from_pandas(data)

in cli.py.

dataset.at[index, 'ground_truths'] = [row['ground_truths']] # Convert single string to list

# Print the dataset
print(dataset)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not need to print

Copy link
Collaborator

@bjwswang bjwswang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comments .

long_description = f.read()

setup(
name="raga_once",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good name ! maybe ragas_once

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the direcotyr name save as your project name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the raga-once has been uploaded, I'm not sure if pypi supports changing the name of it

os.environ["OPENAI_API_KEY"] = api_key
os.environ["OPENAI_API_BASE"] = api_base
base = ChatOpenAI(
model_name=model,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you already have this name configured in ChatOpenAI, can we remove `os.environ'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ragas lib reaches out to os.environ as default, so this is rather like an 'insurance'? We can remove it tho

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's give this file another name.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe wrapper.py?

evaluation/ragacli_pyproject/pyproject.toml Outdated Show resolved Hide resolved
@Lanture1064 Lanture1064 changed the title feat: add ragacli pip package feat: add raga-once pip package Jan 18, 2024
long_description = f.read()

setup(
name="raga-once",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ragas-once or ragas_once

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pypi package name is raga-once, while python subdir name is ragas_once since python requires it. (e.g. python can only read import ragas_once.cli as pkg, but not import ragas-once.cli as pkg

@Lanture1064 Lanture1064 marked this pull request as ready for review January 19, 2024 07:54

```bash
pip install ragas langchain==0.0.354
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this dependency???


```bash
python3 -m ragasonce --api_key "YOUR_OPENAI_API_KEY"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ragasonce ???? maybe regas_once or ragas-once? please keep consistent .

@bjwswang bjwswang merged commit 1475201 into kubeagi:main Jan 19, 2024
9 checks passed
@Lanture1064 Lanture1064 changed the title feat: add raga-once pip package feat: add ragas_once pip package Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants